package com.example.jqying.androiddemo.jump;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.example.jqying.androiddemo.R;

/**
 * Created by apple on 2018/6/22.
 */

public class BActivity extends AppCompatActivity {

    private final String TAG = ">>>>>>BActivity<<<<<<";
    private TextView mTxvMessage;
    private Button mBtnFinish;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.i(TAG,"onCreate");
        setContentView(R.layout.activity_b);
        mTxvMessage = (TextView) findViewById(R.id.txv_message);
        mBtnFinish = (Button) findViewById(R.id.btn_finish);

        final Bundle bundle = getIntent().getExtras();
        String name = bundle.getString("name");
        int number = bundle.getInt("number");
        mTxvMessage.setText(name+":"+number);


        mBtnFinish.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Log.i(TAG,"mBtnFinish onClick");

                Intent intent1 = new Intent();
                Bundle  bundle1 = new Bundle();
                bundle1.putString("tip","I'm back!!!");
                intent1.putExtras(bundle1);
                setResult(Activity.RESULT_OK,intent1);
                finish();

            }
        });


    }
}
